{{define "cp_streaming"}}

{{template "cp_head" .}}
<header class="page-header">
    <h2>Streaming role and announcements</h2>
</header>

{{template "cp_alerts" .}}

<!-- /.row -->
<div class="row">
    <div class="col-lg-12">
        <sction class="card {{if .StreamingConfig.Enabled}}card-featured card-featured-success{{end}}">
            <form method="post" data-async-form>
                <header class="card-header">
                    {{checkbox "enabled" "streaming-enabled-check" `<h2 class="card-title">Enable</h2>` .StreamingConfig.Enabled}}
                </header>
                <div class="card-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <p>This feature uses the streaming status of users in Discord to send announcements and
                                assign a role to them.</p>
                            <p><b>Warning:</b> The stream announcements are the most unreliable feature on this bot, but
                                the streaming role is fairly reliable.</p>
                            <p>
                                Note: The bot needs to have a role higher than the one you are trying to assign to
                                streamers!<br>
                                Note: This only checks your server members streaming status, if you need something else
                                there are several dedicated bots for the purpose of announcing streams.
                                Bots will be ignored.
                            </p>
                        </div>
                        <!-- /.col-lg-12 -->
                    </div>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="form-group">
                                <label>Announce Channel</label>
                                <select class="form-control" name="announce_channel" data-requireperms-send>
                                    {{textChannelOptions .ActiveGuild.Channels .StreamingConfig.AnnounceChannel true "None (disable announcements)"}}
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Announce Message</label>
                                <textarea class="form-control" rows="3"
                                    name="announce_message">{{.StreamingConfig.AnnounceMessage}}</textarea>
                                <p class="help-block">Available template data is {{template "template_helper_user"}},
                                    <code>{{"{{.URL}}"}}</code> (The stream link), <code>{{"{{.Game}}"}}</code> and
                                    <code>{{"{{.StreamTitle}}"}}</code>.</p>
                            </div>
                            <div class="form-group">
                                <label>Game Regex</label>
                                <input type="text" class="form-control" name="game_regex"
                                    value="{{.StreamingConfig.GameRegex}}"></input>
                                <p class="help-block">Filter out the people streaming by their game name (prepend with
                                    <code>(?i)</code> for case insensitivity).</p>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="form-group">
                                <label>Currently Streaming Role</label>
                                <select class="form-control" name="give_role">
                                    {{roleOptions .ActiveGuild.Roles .HighestRole .StreamingConfig.GiveRole "None (disable give role)"}}
                                </select>
                                <p class="help-block">Assign a role to people currently streaming, so you can, for
                                    example, hoist it up to where people can see.</p>
                            </div>
                            <div class="form-group">
                                <label>Allowed Role</label>
                                <select class="form-control" name="require_role">
                                    {{roleOptions .ActiveGuild.Roles nil .StreamingConfig.RequireRole "None"}}
                                </select>
                                <p class="help-block">Only care about the people with this role.</p>
                            </div>
                            <div class="form-group">
                                <label>Ignore Role</label>
                                <select class="form-control" name="ignore_role">
                                    {{roleOptions .ActiveGuild.Roles nil .StreamingConfig.IgnoreRole "None"}}
                                </select>
                                <p class="help-block">Ignore people with this role.</p>
                            </div>
                            <div class="form-group">
                                <label>Stream title regex</label>
                                <input type="text" class="form-control" name="title_regex"
                                    value="{{.StreamingConfig.TitleRegex}}"></input>
                                <p class="help-block">Filter out the people streaming by the stream title (prepend with
                                    <code>(?i)</code> for case insensitivity).</p>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-12">
                            {{template "template_help"}}
                        </div>
                    </div>
                    <!-- /.row -->
                    <div class="row">
                        <div class="col-lg-12">
                            <button type="submit" class="btn btn-primary btn-lg btn-block">Save Streaming
                                Settings</button>
                        </div>
                    </div>
                    <!-- /.row -->
                </div>
                <!-- /.panel-body -->
            </form>
            </section>
            <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>
<!-- /.row -->
{{template "cp_footer" .}}

{{end}}